<template>
  <view>
    <nav-bar title="新增收货地址"></nav-bar>
    <view class="top">
      <search placeholder="请输入您的收货地址" :leftSlot="true"  >
			<template #leftSlot>
				<view class="city" @click="toCity">
					<view style="margin: 0 10rpx;">武汉</view>
					<uni-icons type="bottom" size="12" color="#000"></uni-icons>
				</view>
			</template>
		</search>
    </view>
    <view class="map-page">
      <liu-chooseAddress
        ref="liuChooseAddress"
        :longitude="longitude"
        :latitude="latitude"
        @submit="submitAddress"
        @detele="deteleAddress"
      ></liu-chooseAddress>
	</view>
  </view>
</template>

<script>
	import Search from '../../components/search/index.vue'
  export default {
    name: 'SetAddress',
    components: {
			Search,
		},
    data() {
      return {
        longitude:'114.420181',
        latitude:'30.480688'
      }
    },

    onLoad(options) {
			// this.getLocation();
			// this.setCovers(this.latitude, this.longitude)
    },

    methods: {
      //添加地址成功回调
      submitAddress(e) {
        console.log('添加调地址信息：', e)
      },
      //删除地址回调
      deteleAddress(e) {
        console.log('所删除的地址信息：', e)
      },
      // 地址回显(编辑)调用此方法
      editAddress() {
          let obj = {
              id: '1',
              detailAddress: '', //门牌号(详细地址)
              userName: '', //联系人姓名
              userPhone: '', //手机号
              lableName: '', //标签
              sexType: '', //性别
              title: '', //地址概述
              address: '', //详细地址
              longitude: '', //经度
              latitude: '', //纬度
              agreeState: '', //是否是默认地址
          }
          this.$refs.liuChooseAddress.setData(obj)
      },
      toCity(){
        uni.redirectTo({ url: '/subPages/index/chooseArea' })
      }
    },
  }
</script>
<style lang="scss" scoped>
.map{
  width: 100%;
  height: 100vh;
}
.city {
		display: flex;
		margin-right: 20rpx;
		transform: translateY(15rpx);
	}
</style>